/**
 * Created by clakeboy on 2020/3/10.
 */
import React from 'react';
import classNames from 'classnames/bind';
import windowList from './window/windows';
import {GetComponent} from "../common/Funcs";
import {LoaderComponent} from "@clake/react-bootstrap4";

class Outsite extends React.PureComponent {
    constructor(props) {
        super(props);
        this.windowList = {};
        windowList.forEach((item)=>{
            this.windowList[item.name] = item;
        });
    }

    componentDidMount() {

    }

    on() {

    }

    getClasses() {
        let base = 'bg-light ck-window outsite';

        return classNames(base,this.props.className);
    }

    render() {

        let window = this.windowList[this.props.query.n];
        if (!window) return null;
        return (
            <div className={this.getClasses()}>
                <LoaderComponent loadPath={`/window/${window.uname}.jsx`} parent={this} import={GetComponent}/>
            </div>
        );
    }
}

Outsite.propTypes = {

};

Outsite.defaultProps = {

};

export default Outsite;